<%@ page language="java" contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>


<dwz:paginationForm action="${contextPath}/user/list" page="${page}" onsubmit="return navTabSearch(this)">
	<input type="hidden" name=search_LIKE_name value="${param.search_LIKE_name}"/>
</dwz:paginationForm>
<form method="post" action="${contextPath }/user/list" onsubmit="return navTabSearch(this)">
	<div class="pageHeader">
		<div class="searchBar">
			<ul class="searchContent">
				<li>
					<label>用户名：</label>
					<input type="text" name=search_LIKE_name value="${param.search_LIKE_name}"/>
				</li>
				<li>
					<label>姓名：</label>
					<input type="text" name=search_LIKE_name value="${param.search_LIKE_name}"/>
				</li>
			</ul>
			<div class="subBar">
				<ul>						
					<li><div class="button"><div class="buttonContent"><button type="submit">搜索</button></div></div></li>
				</ul>
			</div>
		</div>
	</div>
</form>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="User:create">
			<li><a iconClass="user_add" mask="true" target="dialog" rel="lookup2user_create" width="540" height="350"  href="${contextPath}/user/create"><span>添加用户</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="User:edit">
			<li><a iconClass="user_edit" target="dialog"  rel="lookup2user_edit" width="540" height="350" mask="true" href="${contextPath }/user/edit/{slt_uid}"><span>编辑用户</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="User:delete">
			<li><a iconClass="user_delete" class="delete" target="selectedTodo" rel="ids"  title="确认要删除用户吗?"   href="${contextPath }/user/delete"><span>删除用户</span></a></li>
			</shiro:hasPermission>
			
			<li class="line">line</li>
			<shiro:hasPermission name="User:restPwd">
			<li><a iconClass="arrow_refresh" target="selectedTodo" rel="ids"  href="${contextPath}/user/restPwd" title="确认要重置密码?"><span>重置密码</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="User:updateStatus">
			<li><a iconClass="user_go"  target="selectedTodo" rel="ids"  href="${contextPath}/user/updateStatus" title="确认更新状态吗?"><span>禁用/启用</span></a></li>
			</shiro:hasPermission>
			<li class="line">line</li>
			<shiro:hasPermission name="User:assign">
			<li><a iconClass="shield_add" mask="true"  target="dialog" width="380" height="550"  href="${contextPath}/user/assign/{slt_uid}"><span>分配角色</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" layoutH="135" width="100%">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th>用户名</th>
				<th>姓名</th>
				<th width="150">邮箱</th>
				<th width="150" >电话</th>
				<th width="150">所在部门</th>
				<th width="150">角色</th>
				<th width="150">账户状态</th>
				<th width="150">创建时间</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${userList}">
			<tr target="slt_uid" rel="${item.id}">
				<td><input name="ids" value="${item.id}" type="checkbox"></td>
				<td>${item.username}</td>
				<td>${item.realname}</td>
				<td>${item.email}</td>
				<td>${item.phone}</td>
				<td>${item.organization.parent.name} / ${item.organization.name}</td>
				<td>
					<c:forEach var="role" varStatus="status" items="${item.roles}">
						<c:if test="${status.index +1 < fn:length(item.roles)}">
                             ${role.name}、      
                        </c:if>
						<c:if test="${status.index +1==fn:length(item.roles)}">
                             ${role.name}
                        </c:if>
					</c:forEach>
				</td>
				<td>
					<c:if test="${item.status == 'enabled' }">
					正常
					</c:if>
					<c:if test="${item.status == 'disabled' }">
					<span style="color:red">禁用</span>
					</c:if>
					
					
				</td>
				<td>${item.createTime}</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<!-- 分页 -->
	<dwz:pagination page="${page}" />

	
</div>